<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:t="http://myfaces.apache.org/tomahawk">
<h:head>
<script type="text/javascript">
	function toggleTag(e,x) {
		JQuery.post('${facesContext.externalContext.requestContextPath}/tags/toggle',
			{'caseRecord':x},
			function(data) {
				if(data['tagged'])
					jQuery(e).attr('src','${facesContext.externalContext.requestContextPath}/images/tag_selected.gif')
				else
					jQuery(e).attr('src','${facesContext.externalContext.requestContextPath}/images/tag_white.gif')
			});				
	}
	function performAjaxSubmit(event) {
		if(event.status == "begin"){
			var doctype = $("select.caseType").val();
			var asExhibitCheckbox = $('.asExhibitCheckbox').prop('checked');		
			var myFile = document.getElementById("myFile").files[0];
			
			var formdata = new FormData();
			formdata.append("doctype", doctype);
			formdata.append("myFile", myFile);	
			formdata.append("asExhibitCheckbox", asExhibitCheckbox);	
			
			
			var xhr = new XMLHttpRequest();
			
			xhr.open("POST","${facesContext.externalContext.requestContextPath}/FileUploader", true);
			xhr.send(formdata);
			
			xhr.onload = function(e) {
	   			if (this.status == 200) {
	   			  
	   			}
	    	};
			}
	}
	
</script>
</h:head>
<h:body>
		<t:panelTabbedPane bgcolor="#FFFFCC" serverSideTabSwitch="false" width="100%">
		 
		  <t:panelTab id="tab1" label="Case Information" rendered="true"> 
		<!-- <t:saveState id="caseDetailsPage" value="#{attCaseDetailsPage}" />-->
			<div class="allPeopleHolder">
			<h:panelGrid columns="2" styleClass="tablehead">
				<h:outputText value="Filer Name:"  />
				<h:outputText value="#{attCaseDetailsPage.filerName}" />
				<h:outputText value="Division:" />
				<h:outputText value="#{attCaseDetailsPage.caseRecord.localCaseDivision.description}" />
				<h:outputText value="Case Category:" />
				<h:outputText value="#{attCaseDetailsPage.caseRecord.localCaseCategory.description}" /> 
				<h:outputText value="Case Filing Type:" />
				<h:outputText value="#{attCaseDetailsPage.caseRecord.localCaseFilingType.description}" />
				<h:outputText value="Case Type: " />
				<h:outputText value="#{attCaseDetailsPage.caseRecord.localCaseType.description}" />
				<h:outputText value="Case Caption: " />
				<h:outputText value="#{attCaseDetailsPage.caseCaption}" />
				<h:outputText value="OCSS Case Number: " />
				<h:outputText value="#{attCaseDetailsPage.OCSSCaseNumber}" />
				<h:outputText value="Court Case Number: " />
				<h:outputText value="#{attCaseDetailsPage.courtCaseNumber}" />
				<h:outputLabel value="Court Date: " />
				<h:outputText value="#{attCaseDetailsPage.courtDate}">
				</h:outputText>
				<h:outputText value="Jurisdiction: " />
				<h:outputText value="#{attCaseDetailsPage.jurisdiction}" />

				
			</h:panelGrid>
			</div> 
			<br />
			<!-- *************************Case Participants*****************************
 			<h:outputText value="CASE PARTICIPANTS" styleClass="header" />-->
 			</t:panelTab>
		   <t:panelTab id="tab2" label="CASE PARTICIPANTS" rendered="true">
 			<!-- ****************************Initiating Party Organization******************-->
 				<div class="grouping">
			<h:outputText value="Initiating Party Organization" styleClass="subHeadingClass" />

			<h:panelGroup>
				<h:dataTable width="100%" value="#{attCaseDetailsPage.initiatingPartyOrganizationDataModel}" var="initiatingPartyOrganization" columnClasses="dataTableColumnClass,dataTableColumnClass" >
					<h:column>
						<f:facet name="header">
							<h:outputText value="Name" styleClass="subHeadingTextClass" />
						</f:facet>
						<h:panelGroup>
							<h:outputText value="#{initiatingPartyOrganization.organizations.name}"
								styleClass="textFont75" />								
							
						</h:panelGroup>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="Address" styleClass="subHeadingTextClass" />
						</f:facet>
						<h:dataTable value="#{initiatingPartyOrganization.organizations.addresses}"
							var="addresses">
							<h:column>
								<h:panelGroup>
									<h:outputText value="#{addresses.address.streetFullText}"
										styleClass="textFont75" />
									<h:outputText value=" " />
									<h:outputText value="#{addresses.address.streetExtensionText}"
										styleClass="textFont75" />
									<h:outputText value=" " />
									<h:outputText value="#{addresses.address.cityName}"
										styleClass="textFont75" />
									<h:outputText value=" " />
									<h:outputText value="#{addresses.address.zipCode}"
										styleClass="textFont75" />
								</h:panelGroup>
							</h:column>
						</h:dataTable>
					</h:column>
				</h:dataTable>
			</h:panelGroup> 
			</div>	
			<!-- ******************************************************************-->
 			<div class="grouping">
			<h:outputText value="Initiating Party Person"
				styleClass="subHeadingClass" /> <h:panelGroup>
				<h:dataTable width="100%" 
					value="#{attCaseDetailsPage.initiatingPartyPersonModel}"
					var="initiatingPartyPerson"
					columnClasses="dataTableColumnClass,dataTableColumnClass">
					<h:column>
						<f:facet name="header">
							<h:outputText value="Name" styleClass="subHeadingTextClass" />
						</f:facet>
						<h:panelGroup>
							<h:outputText value="#{initiatingPartyPerson.person.firstName}"
								styleClass="textFont75" />
							<h:outputText value=" " />
							<h:outputText value="#{initiatingPartyPerson.person.middleName}"
								styleClass="textFont75" />
							<h:outputText value=" " />
							<h:outputText value="#{initiatingPartyPerson.person.lastName}"
								styleClass="textFont75" />
							<h:outputText value=" " />
							<h:outputText value="#{initiatingPartyPerson.person.suffixName}"
								styleClass="textFont75" />
						</h:panelGroup>
					</h:column>
				</h:dataTable>
			</h:panelGroup> 
			</div>
			 <!-- ****************************Defendent Party Person******************-->
 			<div class="grouping">
			<h:outputText value="Defendant Party" styleClass="subHeadingClass" />

			<h:panelGroup>
				<h:dataTable width="100%" value="#{attCaseDetailsPage.defendentPartyPersonModel}" var="defendentParty" columnClasses="dataTableColumnClass,dataTableColumnClass" >
					<h:column>
						<f:facet name="header">
							<h:outputText value="Name" styleClass="subHeadingTextClass" />
						</f:facet>
						<h:panelGroup>
							<h:outputText value="#{defendentParty.person.firstName}"
								styleClass="textFont75" />
							<h:outputText value=" " />
							<h:outputText value="#{defendentParty.person.middleName}"
								styleClass="textFont75" />
							<h:outputText value=" " />
							<h:outputText value="#{defendentParty.person.lastName}"
								styleClass="textFont75" />
							<h:outputText value=" " />
							<h:outputText value="#{defendentParty.person.suffixName}"
								styleClass="textFont75" />
						</h:panelGroup>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="Address" styleClass="subHeadingTextClass" />
						</f:facet>
						<h:dataTable value="#{defendentParty.person.addresses}"
							var="addresses">
							<h:column>
								<h:panelGroup>
									<h:outputText value="#{addresses.address.streetFullText}"
										styleClass="textFont75" />
									<h:outputText value=" " />
									<h:outputText value="#{addresses.address.streetExtensionText}"
										styleClass="textFont75" />
									<h:outputText value=" " />
									<h:outputText value="#{addresses.address.cityName}"
										styleClass="textFont75" />
									<h:outputText value=" " />
									<h:outputText value="#{addresses.address.zipCode}"
										styleClass="textFont75" />
								</h:panelGroup>
							</h:column>
						</h:dataTable>
					</h:column>
				</h:dataTable>
			</h:panelGroup> 
			</div>
			 <!-- *****************************Witness************************************* -->
			 <div class="grouping">
			<h:panelGroup>
				<h:outputText value="Witness" styleClass="subHeadingClass" />
			</h:panelGroup> <h:panelGroup>
				<h:dataTable id="DATATABLE_witness" width="100%" 
					value="#{attCaseDetailsPage.witnessPersonModel}" var="witness"
					columnClasses="dataTableColumnClass,dataTableColumnClass">
					<h:column>
						<f:facet name="header">
							<h:outputText value="Name" styleClass="subHeadingTextClass" />
						</f:facet>
						<h:panelGroup>
							<h:outputText value="#{witness.person.firstName}"
								styleClass="textFont75" />
							<h:outputText value=" " />
							<h:outputText value="#{witness.person.middleName}"
								styleClass="textFont75" />
							<h:outputText value=" " />
							<h:outputText value="#{witness.person.lastName}"
								styleClass="textFont75" />
							<h:outputText value="#{witness.person.suffixName}"
								styleClass="textFont75" />
							<h:outputText value=" " />
						</h:panelGroup>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="Address" styleClass="subHeadingTextClass" />
						</f:facet>
						<h:dataTable value="#{witness.person.addresses}" var="addresses">
							<h:column>
								<h:panelGroup>
									<h:outputText value="#{addresses.address.streetFullText}"
										styleClass="textFont75" />
									<h:outputText value=" " />
									<h:outputText value="#{addresses.address.streetExtensionText}"
										styleClass="textFont75" />
									<h:outputText value=" " />
									<h:outputText value="#{addresses.address.cityName}"
										styleClass="textFont75" />
									<h:outputText value=" " />
									<h:outputText value="#{addresses.address.zipCode}"
										styleClass="textFont75" />
								</h:panelGroup>
							</h:column>
						</h:dataTable>
					</h:column>
				</h:dataTable>
			</h:panelGroup> 
			</div>
			 <!-- ********************************Plaintiff's Attorney*************************** -->
 			<div class="grouping">
			<h:panelGroup>
				<h:outputText value="Plaintiff's Attorney"
					styleClass="subHeadingClass" escape="true" />
			</h:panelGroup> <h:panelGroup>
				<h:dataTable id="DATATABLE_plantiff" width="100%" 
					value="#{attCaseDetailsPage.plantiffsAttorneyModel}"
					var="plantiff" 
					columnClasses="dataTableColumnClass,dataTableColumnClass">
					<h:column>
						<f:facet name="header">
							<h:outputText value="Name" styleClass="subHeadingTextClass" />
						</f:facet>
						<h:panelGroup>
							<h:outputText value="#{plantiff.person.firstName}"
								styleClass="textFont75" />
							<h:outputText value=" " />
							<h:outputText value="#{plantiff.person.middleName}"
styleClass="textFont75" />
							<h:outputText value=" " />
							<h:outputText value="#{plantiff.person.lastName}"
							styleClass="textFont75" />
							<h:outputText value=" " />
							<h:outputText value="#{plantiff.person.suffixName}"
styleClass="textFont75" />
						</h:panelGroup>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="BarID" styleClass="subHeadingTextClass" />
						</f:facet>
						<h:outputText value="#{plantiff.person.attorney.barID}"
							styleClass="textFont75" />
					</h:column>
				</h:dataTable>
			</h:panelGroup> 
			 </div>
			<!-- ********************************Defendent's Attorney*************************** -->
 <div class="grouping">
			<h:panelGroup>
				<h:outputText value="Defendant's Attorney"
					styleClass="subHeadingClass" escape="true" />
			</h:panelGroup> 
			<h:panelGroup>
				<h:dataTable id="DATATABLE_defendent" width="100%" 
					value="#{attCaseDetailsPage.defendentsAttorneyModel}"
					var="defendentsAttorney"
					columnClasses="dataTableColumnClass,dataTableColumnClass">
					<h:column>
						<f:facet name="header">
							<h:outputText value="Name" styleClass="subHeadingTextClass" />
						</f:facet>
						<h:panelGroup>
							<h:outputText value="#{defendentsAttorney.person.firstName}"
								styleClass="textFont75" />
							<h:outputText value=" " />
							<h:outputText value="#{defendentsAttorney.person.middleName}"
								styleClass="textFont75" />
							<h:outputText value=" " />
							<h:outputText value="#{defendentsAttorney.person.lastName}"
								styleClass="textFont75" />
							<h:outputText value=" " />
							<h:outputText value="#{defendentsAttorney.person.suffixName}"
								styleClass="textFont75" />
						</h:panelGroup>
					</h:column>
					<h:column>
						<f:facet name="header">
							<h:outputText value="BarID" styleClass="subHeadingTextClass" />
						</f:facet>
						<h:outputText value="#{defendentsAttorney.person.attorney.barID}"
							styleClass="textFont75" />
					</h:column>
				</h:dataTable>
			</h:panelGroup>
 
		</div>
		<br />
			<!-- *****************************Documents****************************
		<h:outputText value="DOCUMENTS" styleClass="header" />	-->	
			</t:panelTab>
			<t:panelTab id="tab3" label="Case Documents" rendered="true">
			<!-- Upload Document Functionality starts here-->

			<!-- for look up -->			
			<div id="bodypanel" class="grouping"><h:outputLabel
				value="Prepare Filings for Attorney" styleClass="textFont200" /> <br />
			
			<h:panelGrid id="uploadGrid" width="100%" columns="3" styleClass="iCubed">
				<f:facet name="header">
								Document Type
							</f:facet>
				<h:column> 
								Select Document Type: 
							</h:column>
			   <h:column>
					<h:selectOneMenu id="caseType" size="1" class="caseType" value="#{filingDocumentUploadPage.docType}" binding="#{filingDocumentUploadPage.docTypeInput}" title="#{bundle.documentDescription}">
						<f:selectItems id="selectItem" value="#{filingDocumentUploadPage.docTypeDescriptionsItems}"  />
					</h:selectOneMenu>
				</h:column>
				<h:column />
				<h:column>			
								Prepare Document for Filing
							</h:column>
					<h:column>
						<input id="myFile" name="myFile" type="file" />
						<!-- <t:inputFileUpload id="upload"
							value="#{filingDocumentUploadPage.myFile}" storage="file"
							required="true" /> -->
					</h:column>
	
				<h:column />
								<h:column>
					<h:outputText value="Upload as Exhibit:"/>
				</h:column>
				<h:column>
					<h:selectBooleanCheckbox id="asExhibitCheckbox" class="asExhibitCheckbox" value="#{filingDocumentUploadPage.asExhibit}"  title="#{bundle.exhibitButton}" >					
					</h:selectBooleanCheckbox>
				</h:column>				
				
			</h:panelGrid> 
				<h:commandLink id="uploadFile" title="#{bundle.uploadFileButton}" styleClass="button">
				<h:outputText value="UPLOAD FILE"/>
				<f:ajax onevent="performAjaxSubmit" render="panelDocuments  uploadGrid"/>
				</h:commandLink>
			 
			</div>
		
	
	
	<!-- Upload Document Functionality Ends here-->
	
	
	
	
			
			<t:div id="panelDocuments" styleClass="grouping"> 	
			<h:outputText value="Imported Documents" styleClass="tablehead" />		
				<h:panelGrid columns="2" width="100%" >
					<h:dataTable id="DATATABLE_i_documents" width="100%" 
						value="#{attCaseDetailsPage.importedDocumentsModel}"
						var="documents_imported"
						columnClasses="dataTableSubColumnClass,dataTableSubColumnClass">
						<h:column>
							<f:facet name="header">
								<h:outputText value="Title" styleClass="subHeadingTextClass" />
							</f:facet>
							<h:commandLink value="#{documents_imported.title}" action="#{attCaseDetailsPage.viewFile}" styleClass="textFont75">
             					<f:param name="document" value="#{documents_imported}" binding="#{attCaseDetailsPage.documentClicked_Imported}"/>
             					<f:param name="physicalType" value="#{documents_imported.physicalType}" />
         					</h:commandLink>					
						</h:column>
						
						<h:column>
							<f:facet name="header">
								<h:outputText value="Type" styleClass="subHeadingTextClass" />
							</f:facet>
							<h:outputText value="#{documents_imported.documentInstance.description}" styleClass="textFont75" />
						</h:column>
						
						
						<h:column rendered="#{(documents_imported.orderedDoc) and !(documents_imported.signedDoc)}">
							<f:facet name="header">
								<h:outputText value="Sign Document" styleClass="subHeadingTextClass" />
							</f:facet>
							<h:commandLink value="Sign"  styleClass="textFont75Link">								
								<f:ajax listener="#{attCaseDetailsPage.signDocument(documents_uploaded)}" render="DATATABLE_i_documents"/>
							</h:commandLink>
						</h:column>		
						<h:column rendered="#{(documents_imported.signedDoc)}">
							<f:facet name="header">
								<h:outputText value="Sign Document"  />
							</f:facet>
							<h:outputText value="Signed" styleClass="textFont75Bold" /> 
						</h:column>
						
						<h:column rendered="#{!(documents_imported.orderedDoc) and !(documents_imported.signedDoc)}">
							<f:facet name="header">
								<h:outputText value="Sign Document" styleClass="subHeadingTextClass" />
							</f:facet>
							</h:column>	
					
						<h:column rendered="#{(documents_imported.signedDoc)}">
							<f:facet name="header" >
								<h:outputText value=""  />
							</f:facet>
							<h:commandLink value="View Details" action="#{attCaseDetailsPage.viewSignatureDetails}"  styleClass="textFont75Link" >
								<f:param name="doc2" value="#{documents_imported}" binding="#{attCaseDetailsPage.signatureBinding}"/> 							
							</h:commandLink>
						</h:column> 
						
					</h:dataTable>				
				</h:panelGrid>
				
				<br />
				
				<h:outputText value="Uploaded Documents" styleClass="tablehead"  />		
				<h:panelGrid columns="2" width="100%" rendered="#{attCaseDetailsPage.caseRecord.court.upgradedSignSupport}">
					<h:dataTable id="DATATABLE_n_documents_2" width="100%" 
						value="#{attCaseDetailsPage.uploadedDocumentsModel}"
						var="documents_uploaded"
						columnClasses="dataTableSubColumnClass,dataTableSubColumnClass">
						<h:column>
							<f:facet name="header">
								<h:outputText value="Title" styleClass="subHeadingTextClass" />
							</f:facet>
							<h:commandLink value="#{documents_uploaded.title}" action="#{attCaseDetailsPage.viewFile}" styleClass="textFont75">
             					<f:param name="document" value="#{documents_uploaded}" binding="#{attCaseDetailsPage.documentClicked_Uploaded}"/>
             					<f:param name="physicalType" value="#{documents_uploaded.physicalType}" />
         					</h:commandLink>					
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value="Type" styleClass="subHeadingTextClass" />
							</f:facet>
							<h:outputText value="#{documents_uploaded.documentInstance.description}" styleClass="textFont75" />
						</h:column>
						
						
						
						<h:column rendered="#{documents_uploaded.signableByAttorney}">
							<f:facet name="header">
								<h:outputText value="Sign Document" styleClass="subHeadingTextClass" />
							</f:facet>
							<h:commandLink value="Sign"  styleClass="textFont75Link">								
								<f:ajax listener="#{attCaseDetailsPage.signDocument(documents_uploaded)}" render="DATATABLE_n_documents_2"/>
							</h:commandLink>
						</h:column>		
						
						
						<h:column rendered="#{documents_uploaded.signedByAttorney}">
							<f:facet name="header">
								<h:outputText value="Sign Document"  />
							</f:facet>
							<h:outputText value="Signed" styleClass="textFont75Bold" /> 
						</h:column>
					</h:dataTable>				
				</h:panelGrid>
		</t:div>
		</t:panelTab>
		<t:panelTab id="tab4" label="Case Action" rendered="false" >
			<div align="center">
			<br />
			<br />
			<h:commandButton value="Back"
				action="#{attCaseDetailsPage.back}" styleClass="buttonClass" immediate="true" />
			<br />
			<br />
			<h:commandButton value="Modify"
				action="#{attCaseDetailsPage.modifyFiling}" styleClass="buttonClass" 
				rendered="#{attCaseDetailsPage.renderModifyButton}" immediate="true" />
			<br />
			<br />
			<br />
			<h:commandButton value="File New Documents"
				action="#{attCaseDetailsPage.fileNewDocuments}" styleClass="buttonClass" 
				rendered="#{attCaseDetailsPage.renderFileNewDocuments}" immediate="true" title="#{bundle.fileNewDocumentsMessage}"/>
			<br />
			<h:commandButton value="Reject"
				action="#{attCaseDetailsPage.rejectFiling}" styleClass="buttonClass" 
				rendered="#{attCaseDetailsPage.renderRejectReasonButton}" immediate="true" title="#{bundle.rejectCaseMessage}"/>			
			<br />
			<br />
			 <h:outputText value="Comments: " />                                        
			  <br />                        
			 <h:inputTextarea id="comments" value="#{attCaseDetailsPage.comments}"  binding="#{attCaseDetailsPage.commentsInput}"  rows="4" cols="18"/>              
			<br />
			
			<br />
			
			 <h:commandButton value="#{attCaseDetailsPage.sendToCourtText}"
				action="#{attCaseDetailsPage.sendToCourt}" styleClass="buttonClass" 
				rendered="#{attCaseDetailsPage.renderSubmitButton}" immediate="true" title="#{bundle.sendToClerk}"/>
			
			<br />
			<br />
			<h:panelGrid columns="1" styleClass="bodypanel" rendered="#{attCaseDetailsPage.renderModifyButton and attCaseDetailsPage.renderSetCourtDate}"> 
				<!-- 	<h:panelGrid columns="1" styleClass="bodypanel" >   -->	
					<h:outputLabel value="Court Date" styleClass="textFont200"/>
					<h:panelGroup>
						<h:outputLabel value="Original Court Date: "
							styleClass="fontsubhead" /><br />
						<h:outputLabel
							value="#{attCaseDetailsPage.courtDate}"
							styleClass="fontdate">
							
							</h:outputLabel>
							<br />
					</h:panelGroup>
					<h:panelGroup>
						<h:outputLabel value="Proposed Court Date: "
							styleClass="fontsubhead" /><br />
						<h:panelGroup>
						
													
						<h:inputText styleClass="courtDate" id="courtDate"				  																							
							value="#{attCaseDetailsPage.proposedCourtDate}"
							validator="#{attCaseDetailsPage.validateDate}">
							<f:convertDateTime pattern="MM/dd/yyyy" timeZone="EST"/>	
						</h:inputText>	
							<div id="courtDateChooser"  style="font-size: 75%;"/>
							<script>
								jQuery(function() {
									jQuery( "#courtDateChooser" ).datepicker({
											altField: ".courtDate"
									});
									jQuery( ".courtDate").val("");
								});
							</script>	      
			 			</h:panelGroup>
			 			<h:message for="courtDate" styleClass="error" />
					</h:panelGroup>
					<h:panelGroup>
						<h:commandButton value="Submit"
							action="#{attCaseDetailsPage.submitCourtDate}" />
					</h:panelGroup>
				</h:panelGrid>
			<br />
			<br />
			<br />
			<h:panelGrid column="1" width="100%" styleClass="bodypanel" rendered="#{attCaseDetailsPage.renderRejectReasonButton}">
				<h:outputLabel value="Reject Reason:        " styleClass="textFont200"/>
				<h:outputText style="color: red" value = "#{attCaseDetailsPage.caseRecord.rejectionReason}" />
			</h:panelGrid>		
		  </div>	
		</t:panelTab>
		</t:panelTabbedPane>
</h:body>
</html>
